// phalanx config.hpp.cu header file

// Copyright (c) 2010 - 2011 Kohei Takahashi (Flast).
// Distributed under the MIT license. for more detail see COPYING.

#ifndef IG_PHALANX_CONFIG_HPP_CU_ONCE_
#define IG_PHALANX_CONFIG_HPP_CU_ONCE_

#include <phalanx/detail/check.hpp.cu>
#include <phalanx/detail/version.hpp.cu>
#include <phalanx/detail/config.hpp.cu>

#if PHALANX_CUDA_ARCH_MAJOR_VERSION >= 1

# if PHALANX_CUDA_ARCH_MINOR_VERSION >= 0
#   define PHALANX_CUDA_ENABLE_SM10_FEATURES 1

#   define PHALANX_CUDA_MAX_X_DIM_OF_A_GRID   65535
#   define PHALANX_CUDA_MAX_Y_DIM_OF_A_GRID   65535
#   define PHALANX_CUDA_MAX_THREADS_PER_BLOCK 512
#   define PHALANX_CUDA_MAX_X_DIM_OF_A_BLOCK  512
#   define PHALANX_CUDA_MAX_Y_DIM_OF_A_BLOCK  512
#   define PHALANX_CUDA_MAX_Z_DIM_OF_A_BLOCK  64
#   define PHALANX_CUDA_WARP_SIZE             32
#   define PHALANX_CUDA_MAX_BLOCKS_PER_MP     8
#   define PHALANX_CUDA_MAX_WARPS_PER_MP      24
#   define PHALANX_CUDA_MAX_THREADS_PER_MP    768
#   define PHALANX_CUDA_REGISTERS_PER_MP      ( 8 * 1024 )
#   define PHALANX_CUDA_MAX_SHARED_MEM_PER_MP ( 16 * 1024 )

#   define PHALANX_CUDA_SHARED_MEM_BANKS     16
#   define PHALANX_CUDA_LOCAL_MEM_PER_THREAD ( 16 * 1024 )
#   define PHALANX_CUDA_CONSTANT_MEM_SIZE    ( 64 * 1024 )

#   define PHALANX_CUDA_MAX_DIM_OF_1D_ARRAY_TEXTURE  8192
#   define PHALANX_CuDA_MAX_DIM_OF_1D_LINEAR_TEXTURE ( 1 << 27 )
#   define PHALANX_CUDA_MAX_X_DIM_OF_2D_TEXTURE      65536
#   define PHALANX_CUDA_MAX_Y_DIM_OF_2D_TEXTURE      32768
#   define PHALANX_CUDA_MAX_DIM_OF_3D_TEXTURE        2048
#   define PHALANX_CUDA_MAX_TEXTURE                  128
# endif // sm_10

# if PHALANX_CUDA_ARCH_MINOR_VERSION >= 1
#   define PHALANX_CUDA_ENABLE_SM11_FEATURES 1

#   define PHALANX_CUDA_ENABLE_INT_32BIT_ATOMIC 1
# endif // sm_11

# if PHALANX_CUDA_ARCH_MINOR_VERSION >= 2
#   define PHALANX_CUDA_ENABLE_SM12_FEATURES 1

#   define PHALANX_CUDA_ENABLE_INT_64BIT_ATOMIC 1
#   define PHALANX_CUDA_ENABLE_INT_SHARED_32BIT_ATOMIC 1
#   define PHALANX_CUDA_ENABLE_WARP_VOTE 1

#   undef PHALANX_CUDA_MAX_WARPS_PER_MP
#   undef PHALANX_CUDA_MAX_THREADS_PER_MP
#   undef PHALANX_CUDA_REGISTERS_PER_MP
#   define PHALANX_CUDA_MAX_WARPS_PER_MP   32
#   define PHALANX_CUDA_MAX_THREADS_PER_MP 1024
#   define PHALANX_CUDA_REGISTERS_PER_MP   ( 16 * 1024 )
# endif // sm_12

# if PHALANX_CUDA_ARCH_MINOR_VERSION >= 3
#   define PHALANX_CUDA_ENABLE_SM13_FEATURES 1

#   define PHALANX_CUDA_ENABLE_DOUBLE_FLOAT 1
# endif // sm_13

#endif // sm_1x

#if PHALANX_CUDA_ARCH_MAJOR_VERSION >= 2

# if PHALANX_CUDA_ARCH_MINOR_VERSION >= 0
#   define PHALANX_CUDA_ENABLE_SM20_FEATURES 1

#   define PHALANX_CUDA_ENABLE_FLOAT_32BIT_ATOMIC 1
#   define PHALANX_CUDA_ENABLE_BALLOT 1
#   define PHALANX_CUDA_ENABLE_THREADFENCE_SYSTEM 1
#   define PHALANX_CUDA_ENABLE_SYNCTHREAD_COUNT 1
#   define PHALANX_CUDA_ENABLE_SYNCTHREAD_AND 1
#   define PHALANX_CUDA_ENABLE_SYNCTHREAD_OR 1
#   define PHALANX_CUDA_ENABLE_SURFACE 1

#   undef PHALANX_CUDA_MAX_THREADS_PER_BLOCK
#   undef PHALANX_CUDA_MAX_X_DIM_OF_A_BLOCK
#   undef PHALANX_CUDA_MAX_Y_DIM_OF_A_BLOCK
#   undef PHALANX_CUDA_MAX_WARPS_PER_MP
#   undef PHALANX_CUDA_MAX_THREADS_PER_MP
#   undef PHALANX_CUDA_REGISTERS_PER_MP
#   undef PHALANX_CUDA_MAX_SHARED_MEM_PER_MP
#   define PHALANX_CUDA_MAX_THREADS_PER_BLOCK 1024
#   define PHALANX_CUDA_MAX_X_DIM_OF_A_BLOCK  1024
#   define PHALANX_CUDA_MAX_Y_DIM_OF_A_BLOCK  1024
#   define PHALANX_CUDA_MAX_WARPS_PER_MP      48
#   define PHALANX_CUDA_MAX_THREADS_PER_MP    1536
#   define PHALANX_CUDA_REGISTERS_PER_MP      ( 32 * 1024 )
#   define PHALANX_CUDA_MAX_SHARED_MEM_PER_MP ( 48 * 1024 )

#   undef PHALANX_CUDA_SHARED_MEM_BANKS
#   undef PHALANX_CUDA_LOCAL_MEM_PER_THREAD
#   define PHALANX_CUDA_SHARED_MEM_BANKS     32
#   define PHALANX_CUDA_LOCAL_MEM_PER_THREAD ( 512 * 1024 )

#   undef PHALANX_CUDA_MAX_DIM_OF 1D_ARRAY_TEXTURE
#   undef PHALANX_CUDA_MAX_Y_DIM_OF_2D_TEXTURE
#   define PHALANX_CUDA_MAX_DIM_OF_1D_ARRAY_TEXTURE 32768
#   define PHALANX_CUDA_MAX_Y_DIM_OF_2D_TEXTURE     65535
#   define PHALANX_CUDA_MAX_DIM_OF_1D_SURFACE       8192
#   define PHALANX_CUDA_MAX_DIM_OF_2D_SURFACE       8192
#   define PHALANX_CUDA_MAX_SURFACE                 8
# endif // sm_20

# if PHALANX_CUDA_ARCH_MINOR_VERSION >= 1
#   define PHALANX_CUDA_ENABLE_SM21_FEATURES 1
# endif // sm_21

#endif // sm_2x

#endif // IG_PHALANX_CONFIG_HPP_CU_ONCE_

